<?
$params[sid] = $sid;
$params[action] = "showPlanDetails";
$url = "$baseURL/$webDIR/?".encode_params($params);
unset($params);
$params[sid] = $sid;
$params[action] = "order";
$params[plan] = $pid;
$orderurl = "$baseURL/$webDIR/?".encode_params($params);


include('wallet_db.html');
include('../rp2/global_functions.php');
if (!isset($rid) or !isset($pid)) {
	exit("<div>No plan selected!</div>");
}
//-----------------------------------------------------
	$sql['type'] = "SELECT";
	$sql['params'] = "product_id,name,wholesale";
	$sql['table'] = "products";
	$sql['where'] = "reseller_id = '$id' AND type='plan'";
	$sql['options'] = "ORDER BY name";
	$sql['return'] = "struct";
//------------------------------------------------------
if (!$result=sql_exec($sql,$dbh81,'assoc')) {
	exit("Temporary Error!");
}

//-----------------------------------------------------
$sql['type'] = "SELECT";
$sql['params'] = "product_id, name, wholesale, price";
$sql['table'] = "products";
$sql['where'] = "product_id = '$pid'";
$sql['options'] = "";
$sql['return'] = "struct";
//------------------------------------------------------
if (!$res=sql_exec($sql,$dbh81,'assoc')) {
	exit("Temporary Error!");
}
$prid = $res[0]['product_id'];
$plan_name = $res[0]['name'];
$wholesale = $res[0]['wholesale'][12]['USD'];
$wholesale_mo = $wholesale/12;
$mo_price = sprintf("%01.2f",$wholesale_mo);
$ye_price = sprintf("%01.2f",$wholesale);
$mo_price = explode(".",$mo_price);
$ye_price = explode(".",$ye_price);

$rprice = $res[0]['price'][12]['USD'];
$rprice_mo = $rprice/12;
$rmo_price = sprintf("%01.2f",$rprice_mo);
$rye_price = sprintf("%01.2f",$rprice);
$rmo_price = explode(".",$rmo_price);
$rye_price = explode(".",$rye_price);

if (isset($current_plan)) {
	//-----------------------------------------------------
	$sql['type'] = "SELECT";
	$sql['params'] = "wholesale";
	$sql['table'] = "products";
	$sql['where'] = "product_id = '$current_plan'";
	$sql['options'] = "";
	$sql['return'] = "struct";
	//------------------------------------------------------
	if (!$res=sql_exec($sql,$dbh81,'assoc')) {
		exit("Temporary Error!");
	}
	$current_wsp = $res[0]['wholesale'][12]['USD'];
}

if (isset($from_page) && $from_page == 'moveClient2Plan') {
	unset($params);
	$params[sid] = $sid;
	$params[action] = "moveClient2Plan";
	$params['step3'] = 785;
	$params['user_name'] = $username;
	$params['current_expire'] = $current_expire;
	$params['current_plan_name'] = $current_plan_name;
	$params['period_left'] = $period_left;
	$params['amount_to_return'] = $amount_to_return;
	$params['product'] = '12'."|".$prid;
	$moveurl = "$baseURL/$webDIR/?".encode_params($params);
}
?>
<html>
<head>
	<title>ResellersPanel</title>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
	<style>
		body, td, input, select, textarea {
	                font-family: Tahoma, Helvetica, sans-serif;
                        font-size: 11px;
                }
		th {
			height: 20px;
			border:1px #FFC9AD solid;
			background-image: url(images/bg_th.jpg);
			background-position: top;
			background-repeat: repeat-x;
			font-family: Tahoma, Helvetica, sans-serif;
			font-size: 11px;
			font-weight: bold;
			color: #000000;
		}
		.cell {
			padding:5px;
			border-bottom:1px #FFC9AD solid;
			border-left:1px #FFC9AD solid;
			border-right:1px #FFC9AD solid;
		}
		
		.borders {
			    padding: 1px;
				border: #FFC9AD solid;
				border-width: 0px 0px 1px 1px;
				font-size: 11px;
				font-family: Tahoma, Helvetica, sans-serif;
				color: #000000;
				text-decoration: none
		}

		.bTable {
			padding: none;
			border-top:1px #FFC9AD solid;
			border-bottom:1px #FFC9AD solid;
			border-left:1px #FFC9AD solid;
			border-right:1px #FFC9AD solid;
		}
		
		.bTable tr:hover {
			background-color:#FEFDE2;
		}
		
		.bTable td {
				padding: 5px;
				border: none;
				font-size: 11px;
				font-family: Tahoma;
				color: #000000;
				text-decoration: none
		}
		
		.bTable table{
			 border-color: #FFC9AD #FFC9AD #FFC9AD #FFC9AD;
			 border-style: solid;
			 border-top-width: 1px;
			 border-right-width: 1px;
			 border-bottom-width: 0px;
			 border-left-width: 0px;
		}

		.errormsg{
				color: #FF0000;
			font-size: 12pt;
			font-family: Verdana, Arial, Helvetica, sans-serif;
			width: 100%;
			font-weight: bold;
		}
		.price {
			font-size: 20px;
			font-weight: bold;
		}
		.small_price {
			font-size: 13px;
			font-weight: bold;
		}
		.noborder {
			border-bottom:0px;
			border-top:0px;
		}
	</style>
	<script>               
	function callOpener (url) {
		if (window.opener && !window.opener.closed) window.opener.location=url;
		else window.open(url,'subOpener','');
	}
	</script>
</head>
<body onLoad='window.focus();'>
<table width="600" border="0" cellspacing="0" cellpadding="5" >
<form action="<?=$url?>" method="POST">
<? if (isset($from_page) && $from_page == 'moveClient2Plan') { ?>
<input type='hidden' name='username' value="<?=$username;?>">
<INPUT type="hidden" name="current_expire" value="<?=$current_expire;?>">
<INPUT type="hidden" name="current_plan_name" value="<?=$current_plan_name;?>">
<INPUT type="hidden" name="period_left" value="<?=$period_left;?>">
<INPUT type="hidden" name="amount_to_return" value="<?=$amount_to_return;?>">
<?}?>
<tr>
	<td valign='top'>
	<b>Choose another plan: </b><br><br>
	<select name="pid" onChange="this.form.submit();">
	<?
	foreach ($result as $value) {
		if (isset($from_page) && $from_page == 'moveClient2Plan') {
			$wsp = $value['wholesale'][12]['USD'];
			if ($wsp > $current_wsp) {
				$check_var = 1;
			} else {
				$check_var = 0;
			}
		} else {
			$check_var = 1;
		}
		if ($value['product_id'] == $pid) {
			$ch = 'selected';
		} else {
			$ch = '';
		}
		if ($check_var == 1) {
			echo "<option value='".$value['product_id']."' $ch>".$value['name']."</option>";
		}
	}
	?>
	</select>
	<input type='hidden' name='rid' value="<?=$id;?>">
	<? if (isset($current_plan)) {
		echo "<input type='hidden' name='current_plan' value='$current_plan'>";
		echo "<input type='hidden' name='from_page' value='$from_page'>";
	}
	?><br><br>
	<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th colspan=3>Wholesale Price</th>
  </tr>
  <tr>
    <td onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
    <table width='100%' style="border-bottom:1px #FFC9AD solid; border-left:1px #FFC9AD solid; border-right:1px #FFC9AD solid;" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="20" align="left" valign="middle">&nbsp;&nbsp;Monthly:</td>
          <td width="7"></td>
          <td align="right" valign="middle">$ <span class='price'>
            <?=$mo_price[0];?>
            </span><sup class="small_price">
            <?=$mo_price[1];?>
            </sup>&nbsp;&nbsp;</td>
        </tr>
        <tr>
          <td height="20" align="left" valign='middle'>&nbsp;&nbsp;Annually:</td>
          <td></td>
          <td align="right" valign='middle'>$ <span class='price'>
            <?=$ye_price[0];?>
            </span><sup class="small_price">
            <?=$ye_price[1];?>
            </sup>&nbsp;&nbsp;</td>
        </tr>
      </table></td>
  </tr>
  <tr>
  	<td colspan=3>&nbsp;</td>
  </tr>
  <tr>
    <th colspan=3>Retail Price</th>
  </tr>
  <tr>
    <td onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
    <table width='100%' style="border-bottom:1px #FFC9AD solid; border-left:1px #FFC9AD solid; border-right:1px #FFC9AD solid;" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="20" align="left" valign="middle">&nbsp;&nbsp;Monthly:</td>
          <td width="7"></td>
          <td align="right" valign="middle">$ <span class='price'>
            <?=$rmo_price[0];?>
            </span><sup class="small_price">
            <?=$rmo_price[1];?>
            </sup>&nbsp;&nbsp;</td>
        </tr>
        <tr>
          <td height="20" align="left" valign='middle'>&nbsp;&nbsp;Annually:</td>
          <td></td>
          <td align="right" valign='middle'>$ <span class='price'>
            <?=$rye_price[0];?>
            </span><sup class="small_price">
            <?=$rye_price[1];?>
            </sup>&nbsp;&nbsp;</td>
        </tr>
      </table>
      </td>
  </tr>
</table>
	  </td>
		<td width="30">&nbsp;</td>
		<td valign='top'>
		<? print_plan_properties2($pid); ?>
		</td>
	</tr>
	<tr>
		<td valign='top' align='right'>&nbsp;</td>
		<td colspan="2" valign='top' align='center'>
		<? if (!isset($from_page)) { ?>
			<input type='button' name='order_me' value='Order <?=$plan_name;?>!' onClick="callOpener('<?=$orderurl;?>'); window.close();">
		<? } elseif (isset($from_page) && $from_page == 'moveClient2Plan') {
				echo "<input type='button' name='change_me' value='Upgrade $username to $plan_name Plan!' onClick=\"callOpener('$moveurl;'); window.close();\">";			
			} else {
				echo "&nbsp;";
			}?>
		</td>
	</tr>
  </form>
</table>
	<br><br>
<b>ADDITIONAL PLAN DETAILS:</b><br>
<br>
<table width="600"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top"><table width="190"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>&raquo; FREE set up<br>
            &raquo; 30 days money back guarantee</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th>&raquo; Customer Support</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">24/7 customer support<br>
          Extensive online documentation<br>Integrated ticketing system<br>1 hour response guarantee</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th>&raquo; Free Features</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">FrontPage Extensions support<br>Elefante Installer - 38 FREE ready-to-use popular scripts</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th>&raquo; Site Statistics</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">Raw access and error logs<br>Detailed bandwidth stats</td>
        </tr>
        <tr>
          <td></td>
        </tr>
    </table></td>
    <td width="15"></td>
    <td valign="top"><table width="190"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th>&raquo; E-mail Features</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">SPAM filter<br>E-mail filter<br>Web e-mail<br>POP3 server<br>SMTP server<br>E-mail forwarding<br>Autoresponder e-mails<br>Catch-all e-mails<br>Anti-Virus protection</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th>&raquo; Scripting and Database</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">phpMyAdmin<br>Perl support<br>PHP support<br>PHP support in HTML files<br>Over 3500 Perl modules</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
    </table></td>
    <td width="15"></td>
    <td valign="top"><table width="190"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th>&raquo; Site Management Tools</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">Multi-Lingual Control Panel<br>Web based file manager<br>Custom ERROR 404 page<br>Password protected directories</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th>&raquo; Misc Features</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">Instant account activation<br>SSL with certificate generation<br>SSI support<br>Custom MX and A records</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th>&raquo; OS, Connectivity and Back-up</th>
        </tr>
        <tr onMouseOver="this.style.backgroundColor='#FEFDE2'" onMouseOut="this.style.backgroundColor='white'";>
          <td class="cell">Stable Linux with Apache<br>2.5 GBits network connectivity<br>Daily data back-up<br>
          UPS &amp; diesel back-up generator</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
<br><br>	
	<p align="center">[<a href='#' onclick="window.close();">CLOSE THE WINDOW</a>]&nbsp;
	[<a href='#' onclick="window.print();">PRINT THE WINDOW</a>]</p>
</body>
</html>
